package com.jyw.business.ast.domain.vo.web;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jyw.business.ast.domain.AstConsumableRecord;
import com.jyw.common.annotation.Conversion;
import com.jyw.common.annotation.Excel;
import com.jyw.common.enums.ConversionType;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.vo.SimpleFileVo;
import com.jyw.system.utils.FileUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldNameConstants;

import java.util.Date;
import java.util.List;

@Data
@ApiModel("耗材详情-出入库记录")
@FieldNameConstants
@NoArgsConstructor
public class AstConsumableReserveRecordVo {
    /** 主键 */
    @ApiModelProperty("主键")
    private Long id;

    /** 数量 */
    @ApiModelProperty("数量")
    private Integer quantity;

    /** 备注 */
    @ApiModelProperty("备注")
    private String remark;

    /** 附件 */
    @ApiModelProperty("附件")
    private List<SimpleFileVo> enclosure;

    /** 创建人 */
    @ApiModelProperty("创建人")
    @Conversion(value = ConversionType.USER,name = Fields.createUserToName)
    private Long createUser;

    @ApiModelProperty("创建人名称")
    private String createUserToName;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    public AstConsumableReserveRecordVo(AstConsumableRecord record) {
        BeanUtils.copyProperties(record,this);
        setEnclosure(FileUtils.IdToFile(record.getEnclosureId()));
    }
}
